﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ContentPlaceHolderID="ScriptContent" runat="server">

	<script language="javascript" type="text/javascript">
		$(function ()
		{
			$.ajaxSetup({ cache: false });

			$("#btnClickToLaunch").click(function ()
			{
				// Pop dialog with loading message
				var $target = $("#formhost");
				$target.html("Loading...").show();

				$target.dialog(
				{
					title: "Dialog test",
					modal: true,
					width: 500,
					close: function () { $target.html("Loading...").hide(); }
				});

				// Load the form into it.
				$target.load("/AjaxUiForm/FormFragment", null, null);
			});
		});
	</script>

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

	<h2>AJAX UI FORM VALIDATION</h2>

	<p>This sample, requested by a commenter on my blog, demonstrates jQuery validation when your form is presented using jQuery UI dialogs.</p>
	<p>This sample will validate client and server side, a custom validation executes on the server side, so try making the client validation pass, but in the author
	field use "Tony Johnson". This will fail server side validation only. In addition, try "Bill Gates" as the author to trigger custom client side validator and "Richard Branson" 
	to trigger the same custom validation, but on the server side.</p>

	<h3><a href=javascript:void(0);" id="btnClickToLaunch">Click to open dialog</a></h3>

	<div id="formhost" style="display:none;"></div>
</asp:Content>
